find the factor of given number in java